<?php 
include 'method/win.php';

if(!isset($_SESSION['adminuser'])){
    show_msg("请先登录!","A-login.php");
}
if(isset($_GET['action'])){
    logout();
}
$defwbsql = "select * from weibo_complaint where cm_id is null and kidcm_id is null";
$defwbres = $conn->query($defwbsql);

$defcmsql = "select * from weibo_complaint where weibo_id is null and kidcm_id is null";
$defcmres = $conn->query($defcmsql);

$defkidcmsql = "select * from weibo_complaint where cm_id is null and weibo_id is null";
$defkidcmres = $conn->query($defkidcmsql);

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>举报处理</title>
    <link rel="stylesheet" href="css/A-public.css">
    <link rel="stylesheet" href="css/A-report.css">
    <link rel="stylesheet" href="../lib/bootstrap/css/bootstrap.css">
    <script src="../lib/jquery/jquery.js" type="text/javascript"></script>
</head>
<body style="background-color:#a1a3a6;">
<h3>举报处理</h3>
<div class="user">

    <span class="span1">当前登录管理员为：<span class="username"><?php echo $_SESSION['adminuser']?></span></span>

    <a class="float-right leave" href="A-index.php?action=logout">退出</a>
    <a class="leave" href="A-index.php">返回</a>
</div>
<!-- <div class="well"> -->
<!--     <form class="search"> -->
<!--         <input type="text" class="input-top" placeholder="请输入搜索内容"> -->
<!--         <button class="submit glyphicon glyphicon-search"/> -->
<!--     </form> -->
<!-- </div> -->

<div class="btn-groups-1" role="group" aria-label="...">
    <div class="btn-group" role="group">
        <button id="nav-1" type="button" class="btn1 btn btn-default">微博</button>
    </div>
    <div class="btn-group" role="group">
        <button id="nav-2" type="button" class="btn1 btn btn-default">评论</button>
    </div>
    <div class="btn-group" role="group">
        <button id="nav-3" type="button" class="btn1 btn btn-default">回复</button>
    </div>
</div>


<!--举报微博内容-->
<div class="table-div1 table-responsive choose-1" id="div1">
    <div class="overlook" role="group" aria-label="...">
        <button style="width: 100px" type="button" onclick="aIgnoreWb()" class="btn btn-default">一键忽略</button>
    </div>
    <table class="table1 table-bordered">
        <tr class="">
            <td>序号</td>
            <td>id</td>
            <td>账号</td>
            <td>举报微博内容</td>
            <td>微博图片</td>
            <td>操作</td>
        </tr>
        <?php 
        $wbno = 1;
        if($defwbres->num_rows){
            $firstwbrow = $defwbres->fetch_assoc();
            $wbstr = "weibo_id = ".$firstwbrow['weibo_id'];
            while($otherwbrows = $defwbres->fetch_assoc()){
                $wbstr = $wbstr." || weibo_id = ".$otherwbrows['weibo_id'];
            }
            $wbsql = "select * from weibo_list where ".$wbstr;
            $wbres = $conn->query($wbsql);
            while($rows = $wbres->fetch_assoc()){
                echo "<tr class=''>";
                echo "<td>".$wbno."</td>";
                echo "<td>".$rows['weibo_id']."</td>";
                echo "<td>".$rows['author']."</td>";
                echo "<td>".$rows['weibo_content']."</td>";
                if($rows['weibo_img']){
                    echo "<td><img src='../".$rows['weibo_img']."' style='width: 167px ;height: 167px'></td>";
                }else{
                    echo "<td><div style='width: 167px; height: 167px'></div></td>";
                }
                echo "<td><button type='button' onclick=ignoreWb(".$rows['weibo_id'].") class='btn btn-default'>忽略</button>";
                echo "<button type='button' onclick=dealWb(".$rows['weibo_id'].") class='btn btn-default'>删除</button></td></tr>";
                $wbno = $wbno+1;
            }
        }else{
            echo "<tr class=''>暂无投诉微博<tr>";
        }
        ?>
    </table>
</div>



<!--举报评论内容-->

<div class="table-div2 table-responsive" id="div2">
    <div class="overlook" role="group" aria-label="...">
        <button style="width: 100px" onclick="aIgnoreCm()" type="button" class="btn btn-default">一键忽略</button>
    </div>
    <table class="table2 table-bordered">
        <tr class="">
            <td>序号</td>
            <td>id</td>
            <td>账号</td>
            <td>举报评论内容</td>
            <td>操作</td>
        </tr>
        <?php
        $cmno = 1;
        if($defcmres->num_rows){
            $firstcmrow = $defcmres->fetch_assoc();
            $cmstr = "cm_id = ".$firstcmrow['cm_id'];
            while($othercmrows = $defcmres->fetch_assoc()){
                $cmstr = $cmstr." || cm_id = ".$othercmrows['cm_id'];
            }
            $cmsql = "select * from weibo_comment where ".$cmstr;
            $cmres = $conn->query($cmsql);
            while ($rows = $cmres->fetch_assoc()){
                echo "<tr class=''>";
                echo "<td>".$cmno."</td>";
                echo "<td>".$rows['cm_id']."</td>";
                echo "<td>".$rows['cm_author']."</td>";
                echo "<td>".$rows['cm_content']."</td>";
                echo "<td><button type='button' onclick=ignoreCm(".$rows['cm_id'].") class='btn btn-default'>忽略</button>";
                echo "<button type='button' onclick=dealCm(".$rows['cm_id'].") class='btn btn-default'>删除</button></td></tr>";
                $cmno = $cmno+1;
            }
        }else{
            echo "<tr class=''>暂无投诉评论</tr>";
        }
        ?>
    </table>
</div>






<!--举报回复内容-->
<div class="table-div3 table-responsive" id="div3">
    <div class="overlook" role="group" aria-label="...">
        <button style="width: 100px" onclick="aIgnoreKidCm()" type="button" class="btn btn-default">一键忽略</button>
    </div>
    <table class="table3 table-bordered">
        <tr class="">
            <td>序号</td>
            <td>id</td>
            <td>账号</td>
            <td>举报回复内容</td>
            <td>操作</td>
        </tr>
        <?php 
        $kcmno = 1;
        if($defkidcmres->num_rows){
            $firstkidcmrow = $defkidcmres->fetch_assoc();
            $kidcmstr = "kidcm_id = ".$firstkidcmrow['kidcm_id'];
            while($otherkidcmrows = $defkidcmres->fetch_assoc()){
                $kidcmstr = $kidcmstr." || kidcm_id = ".$otherkidcmrows['kidcm_id'];
            }
            $kidcmsql = "select * from weibo_kidcomment where ".$kidcmstr;
            $kidcmres = $conn->query($kidcmsql);
            while($rows = $kidcmres->fetch_assoc()){
                echo "<tr class=''>";
                echo "<td>".$kcmno."</td>";
                echo "<td>".$rows['kidcm_id']."</td>";
                echo "<td>".$rows['kidcm_author']."</td>";
                echo "<td>".$rows['kidcm_content']."</td>";
                echo "<td><button type='button' onclick=ignoreKidCm(".$rows['kidcm_id'].") class='btn btn-default'>忽略</button>";
                echo "<button type='button' onclick=dealKidCm(".$rows['kidcm_id'].") class='btn btn-default'>删除</button></td></tr>";
            }
        }else{
            echo "<tr class=''>暂无投诉回复</tr>";
        }
        ?>
    </table>
</div>
</body>
<script>
	function aIgnoreWb(){
		var tipIgnoreAllWb = confirm("你确定忽略所有投诉的微博吗？")
    	if(tipIgnoreAllWb){
    		$.ajax({
                type:"post",
        		url:"method/ignoreallwb_action.php",
        		success:function(data){
        				alert(data)
        		}
            });
    		location.reload();
    	}
	}
	function ignoreWb(id){
		var tipIgnoreWb = confirm("你确定要忽略此投诉吗？")
		if(tipIgnoreWb){
			$.ajax({
                type:"post",
                data:{id: id},
        		url:"method/ignorewb_action.php",
        		success:function(data){
        				alert(data)
        		}
            });
			location.reload();
		}
	}
	function dealWb(id){
		var tipDealWb = confirm("你确定要删除该微博吗？")
		if(tipDealWb){
			$.ajax({
                type:"post",
        		url:"method/dealwb_action.php",
        		data:{id: id},
        		success:function(data){
        				alert(data)
        		}
            });
			location.reload();
		}
	}
	function aIgnoreCm(){
		var tipIgnoreAllCm = confirm("你确定忽略所有投诉的评论吗？")
    	if(tipIgnoreAllCm){
    		$.ajax({
                type:"post",
        		url:"method/ignoreallcm_action.php",
        		success:function(data){
        				alert(data)
        		}
            });
    		location.reload();
    	}
	}
	function ignoreCm(id){
		var tipIgnoreCm = confirm("你确定要忽略此投诉吗？")
		if(tipIgnoreCm){
			$.ajax({
                type:"post",
                data:{id: id},
        		url:"method/ignorecm_action.php",
        		success:function(data){
        				alert(data)
        		}
            });
			location.reload();
		}
	}
	function dealCm(id){
		var tipDealCm = confirm("你确定要删除该评论吗？")
		if(tipDealCm){
			$.ajax({
                type:"post",
        		url:"method/dealcm_action.php",
        		data:{id: id},
        		success:function(data){
        				alert(data)
        		}
            });
			location.reload();
		}
	}
	function aIgnoreKidCm(){
		var tipIgnoreAllKidCm = confirm("你确定忽略所有投诉的回复吗？")
    	if(tipIgnoreAllKidCm){
    		$.ajax({
                type:"post",
        		url:"method/ignoreallkidcm_action.php",
        		success:function(data){
        				alert(data)
        		}
            });
    		location.reload();
    	}
	}
	function ignoreKidCm(id){
		var tipIgnoreKidCm = confirm("你确定要忽略此投诉吗？")
		if(tipIgnoreKidCm){
			$.ajax({
                type:"post",
                data:{id: id},
        		url:"method/ignorekidcm_action.php",
        		success:function(data){
        				alert(data)
        		}
            });
			location.reload();
		}
	}
	function dealKidCm(id){
		var tipDealKidCm = confirm("你确定要删除该回复吗？")
		if(tipDealKidCm){
			$.ajax({
                type:"post",
        		url:"method/dealkidcm_action.php",
        		data:{id: id},
        		success:function(data){
        				alert(data)
        		}
            });
			location.reload();
		}
	}

    $("#nav-1").click(function () {
        $("#div1").removeClass("choose-1")
        $("#div2").removeClass("choose-1")
        $("#div3").removeClass("choose-1")
        $("#div1").addClass("choose-1")
    })
    $("#nav-2").click(function () {
        $("#div1").removeClass("choose-1")
        $("#div2").removeClass("choose-1")
        $("#div3").removeClass("choose-1")
        $("#div2").addClass("choose-1")
    })
    $("#nav-3").click(function () {
        $("#div1").removeClass("choose-1")
        $("#div2").removeClass("choose-1")
        $("#div3").removeClass("choose-1")
        $("#div3").addClass("choose-1")
    })
	

</script>
</html>